//
//  ServiceEvaluationContentCell.m
//  BusinessMarket
//
//  Created by Michael Li on 2018/12/10.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "ServiceEvaluationContentCell.h"

@interface ServiceEvaluationContentCell()<UITextViewDelegate>
@property (weak, nonatomic) IBOutlet UIView *view;
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (weak, nonatomic) IBOutlet UILabel *lineL;
@property (weak, nonatomic) IBOutlet UILabel *nickNamedHidden;
@property (weak, nonatomic) IBOutlet UIButton *hiddenNickBtn;

@end
@implementation ServiceEvaluationContentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.view.layer.masksToBounds = YES;
    self.view.layer.cornerRadius = 3;
    self.view.layer.borderColor  = [UIColor colorWithRed:223/255.0 green:223/255.0 blue:224/255.0 alpha:1].CGColor;
    self.view.layer.borderWidth  = 1;
    self.lineL.textColor = kLineColor;
    self.textView.delegate= self;
//    self.ivBtn = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 50, 50)];
//    [self.contentView addSubview:self.ivBtn];
//    [self.ivBtn setBackgroundImage:[UIImage imageNamed:@"add-images"] forState:UIControlStateNormal];
}
- (void)textViewDidChange:(UITextView *)textView
{
    if ([self.delegate respondsToSelector:@selector(serviceEvaluationContentCell:withAddIVBtn:withTextView:withSelect:)]) {
        [self.delegate serviceEvaluationContentCell:self withAddIVBtn:self.selectIVBtn withTextView:textView withSelect:self.hiddenNickBtn.selected];
    }
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder]) {
//        self.ivBtn = [[UIButton alloc]initWithFrame:CGRectMake(26, 267, 50, 50)];
//        [self.contentView addSubview:self.ivBtn];
//        [self.ivBtn setBackgroundImage:[UIImage imageNamed:@"add-images"] forState:UIControlStateNormal];
//        [self.ivBtn addTarget: self action:@selector(addIVBtn:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

- (IBAction)selectIVBtn:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(serviceEvaluationContentCell:withAddIVBtn:)]) {
        [self.delegate serviceEvaluationContentCell:self withAddIVBtn:sender ];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)nickNamedBtn:(UIButton *)sender {
    sender.selected = !sender.selected;
    if ([self.delegate respondsToSelector:@selector(serviceEvaluationContentCell:withAddIVBtn:withTextView:withSelect:)]) {
        [self.delegate serviceEvaluationContentCell:self withAddIVBtn:sender withTextView:self.textView withSelect:sender.selected];
    }
}

@end
